package fr.perso.ppo.springintegration.event;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.integration.Message;

public class PaymentEventHandler {
	
	private static Logger log = LoggerFactory.getLogger(PaymentEventHandler.class);
	
	
	public EventLog detectNewPayment(Message<?> msg) throws Exception {
		log.debug("************* {} ********************" , msg.getPayload().toString());
		List<?> payload = (List<?>) msg.getPayload();
		
		String logMessage = "================ Nouveaux fonds détectés(%d) : un message a logger dans le journal d'echange===================";
		
		return new EventLog(String.format(logMessage,payload.size()));
		
	}

}
